<?php 
	defined('_JEXEC') or die('Restricted access');
	$params = $this->hparams->params;
	$showhlreadmore 				= 	intval (trim( $params->get('showhlreadmore', 0) ));
	$i = 0;
	require_once (JPATH_COMPONENT.DS.'helpers'.DS.'helper.php');
	
	$numberofheadlinenews = intval ($params->get('numberofheadlinenews',0));
	$bigmaxchar = $params->get('bigmaxchars',0);
	$autoresize = intval (trim( $params->get( 'autoresize', 0) ));
	$bigitems = $params->get('bigitems',1);
	$bigshowimage = $params->get('bigshowimage',0);
	$bigimg_w = $params->get('bigimg_w',0);
	$bigimg_h = $params->get('bigimg_h',0);
	$bigimgalign = $params->get('bigalign',0);
	$smallimgalign = $params->get('smallalign',0);
	
	$smallmaxchar = $params->get('smallmaxchars',0);
	$smallitems = $numberofheadlinenews - $bigitems;
	$smallshowimage = $params->get('smallshowimage',0);
	$smallimg_w = $params->get('smallimg_w',0);
	$smallimg_h = $params->get('smallimg_h',0);
	
	$rows = $this->hlrows;
	
	JHTML::stylesheet('',JaNewsHelper::getFile('ja.news.fp.css','components/com_janews/assets/','components/com_janews/assets/'));
?>

<?php //begin headline template ?>
<div id="jazin-hlwrap" class="clearfix">

	<div id="jazin-hlfirst">
	
	<?php foreach ($rows as $news) :
	if($i<$bigitems) :
		$link   = JRoute::_(ContentHelperRoute::getArticleRoute($news->slug, $news->catslug, $news->sectionid));
		$image = JaNewsHelper::replaceImage ($news, $bigimgalign, $autoresize, $bigmaxchar, $bigshowimage, $bigimg_w, $bigimg_h);
	  //First new
	?>
		<div class="jazin-contentwrap">
			<div class="jazin-content clearfix">
				<?php echo $image; ?>
				<h2 class="jazin-title"><a href="<?php echo $link;?>" title="<?php echo strip_tags($news->title); ?>"><?php echo $news->title;?></a></h2>
				<?php //echo $bigmaxchar?$news->introtext1:$news->introtext;?>
				<?php 
      	    if($bigmaxchar > strlen($news->introtext)) {
          		echo $news->introtext;
          	} else {
          		echo $news->introtext1;
          	}
      	?>
      	<?php if ($showhlreadmore) {?>
      	<a href="<?php echo $link;?>" class="readon"><?php echo JText::_('READ MORE...');?></a>
      	<?php } ?>
			</div>
		</div>
  <?php if($i==$bigitems-1):?>
  
	</div>
	<div id="jazin-hlnext">
	<?php endif;?>
	<?php else: ?>
	<?php
		$link   = JRoute::_(ContentHelperRoute::getArticleRoute($news->slug, $news->catslug, $news->sectionid));
		$image = JaNewsHelper::replaceImage ($news, $smallimgalign,  $autoresize, $smallmaxchar, $smallshowimage, $smallimg_w, $smallimg_h);
	  //Next news
	?>
		<div class="jazin-contentwrap">
			<div class="jazin-content clearfix">
				<?php echo $image; ?>
				<h4 class="jazin-title"><a href="<?php echo $link;?>" title="<?php echo strip_tags($news->title); ?>"><?php echo $news->title;?></a></h4>
				<?php echo $smallmaxchar?$news->introtext1:$news->introtext;?>
				<?php if ($showhlreadmore) {?>
      	<a href="<?php echo $link;?>" class="readon"><?php echo JText::_('READ MORE...');?></a>
      	<?php } ?>
			</div>
		</div>
	<?php
	endif;
	++$i;
	endforeach;?>
	</div>

</div>

<span class="article_separator">&nbsp;</span>
<!--the end the headline of frontpage-->